package com.jhc.drone.communication.enums;

import com.jhc.drone.communication.ws.WsDto;
import com.jhc.drone.communication.ws.WsEndpoint;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * @describe 描述：相机模式枚举
 * @author lcp
 *
 */
@Slf4j
@Getter
public enum CameraEnum {

    CAMERA_MODE_IMAGE((short) 0, "拍照模式"),
    CAMERA_MODE_VIDEO((short) 1, "视频录制模式"),
    CAMERA_MODE_IMAGE_SURVEY((short) 2, "图像测绘模式"),
    CAMERA_MODE_ENUM_END((short) 3, "结束");

    private final short code;

    private final String name;

    CameraEnum(short code, String name) {
        this.code = code;
        this.name = name;
    }

    public static CameraEnum getModel(short code) {
        return Stream.of(CameraEnum.values()).filter(a -> Objects.equals(a.getCode(), code)).findFirst().orElse(CAMERA_MODE_ENUM_END);
    }

}
